unit uPadrao;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FocusDBGrid;

type
  Tfm_Padrao = class(TForm)
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    procedure UpdateDBGrids(var Ref{TForm};pDBGrid:TFocusDBGrid);virtual;
    procedure Liberar(var Ref);
    { Public declarations }
  end;

var
  fm_Padrao: Tfm_Padrao;

implementation

uses
  uErro;

{$R *.dfm}

procedure Tfm_Padrao.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  try
    Action := caFree;
  except
    on E:Exception do
      TErro.GravarErro(Self.ClassName,'FormClose',E,True);
  end;
end;

procedure Tfm_Padrao.Liberar(var Ref);
begin
  try
    TForm(Ref) := nil;
  except
    on E:Exception do
      TErro.GravarErro(Self.ClassName,'FormClose',E,True);
  end;
end;

procedure Tfm_Padrao.UpdateDBGrids(var Ref{TForm};pDBGrid:TFocusDBGrid);
begin
  if Assigned(TForm(Ref)) and (TForm(Ref) <> Nil) then
  begin
    try
      TFocusDBGrid(TForm(Ref).FindComponent(pDBGrid.Name)).AtualizarConsulta;
    except
      on E:Exception do
        TErro.GravarErro(Self.ClassName,'UpdateDBGrids',E,false);
    end;
  end;
end;

end.
